#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
#define ts first
#define id second
using namespace std;

const int N = 1e5 + 10;
typedef pair<int, int> pii;
pii blog[N];
bool hot[N];
int cnt[N];
int n, d, k;

int main() {
    scanf("%d%d%d", &n, &d, &k);
    int maxt = 0;
    for (int i = 1; i <= n; i++)
    {
        scanf("%d%d", &blog[i].ts, &blog[i].id);
        maxt = max(blog[i].ts, maxt);
    }

    for (int time = 0; time <= maxt; time++)
    {
        memset(cnt, 0, sizeof(cnt));
        for (int i = 1; i <= n; i++)
        {
            int t = blog[i].ts;
            int id = blog[i].id;
            if (t >= time && t < time + d)
                cnt[id]++;
            if (cnt[id] >= k)
                hot[id] = true;
        }
    }
    for (int i = 0; i <= 1e5; i++)
        if (hot[i]) printf("%d\n", i);

}





